m = int(input())
n = int(input())

nums1 = []
nums2 = []

for i in range(m):
    nums1.append(int(input()))

for i in range(n):
    nums2.append(int(input()))

if(len(nums1) > len(nums2)):
    nums1, nums2 = nums2, nums1
    m, n = n , m

s = (m+n)//2

i1 = 0
i2 = m

judge = 1

if(nums1[-1] <= nums2[0]):
    if(len(nums1) == len(nums2)):
        result = (nums1[-1] + nums2[0])/2
    else:
        if((m+n)%2):
            result = nums2[s-m]
        else:
            result = (nums2[s-m] + nums2[s-m-1]) / 2
    judge = 0

if(nums1[0] >= nums2[-1]):
    if(len(nums1) == len(nums2)):
        result = (nums2[-1] + nums1[0])/2
    else:
        if((m+n)%2):
            result = nums2[s]
        else:
            result = (nums2[s] + nums2[s-1]) / 2
    judge = 0
    

i = None
j = None

while(judge):
    mid = (i1+i2)//2
    mid1 = (s-2-mid)

    if(nums1[mid] <= nums2[mid1+1] and nums2[mid1] <= nums1[mid+1]):
        i = mid
        j = mid1
        break
    elif(nums1[mid] > nums2[mid1 + 1]):
        i2 = mid
    else:
        i1 = mid

if(judge):
    if((m+n)%2):
        result = min(nums1[i+1],nums2[j+1])
    else:
        result = ((max(nums1[i],nums2[j])) + min(nums1[i+1],nums2[j+1]))/2

print(round(float(result),1))